<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Thinking Craftsman Toolkit</title>
<style type="text/css">
<!--
.style1 {
	color: #000000;
	background: #BCBCBC;
}
-->
</style>
</head>

<body>
<h1 align="center">Thinking Craftsman Toolkit</h1>
<div align="center">Verstion : 0.6.0</div>
<h2 class="style1">Introduction</h2>
<p><em><a href="http://code.google.com/p/tctoolkit">Thinking Craftsman Toolkit</a></em> is a setup of tools for analyzing source code in various ways. Currently there are 3 tools  </p>
<ol>
  <li>
    <div align="justify"><strong>Code Duplication Detector (CDD)</strong>:<br />
      Code duplication detector is similar to <a href="http://pmd.sourceforge.net/cpd.html">Copy Paste Detector (CPD)</a> or <a href="http://www.redhillconsulting.com.au/products/simian/">Simian</a>. It uses <a href="http://pygments.org/">Pygments</a> Lexer to parse the source files and uses <a href="http://en.wikipedia.org/wiki/Rabin-Karp_string_search_algorithm">Rabin Karp</a> algorithm to detect the duplicates. Hence it supports all languages supported by <em>Pygments</em>.
    </div>
  </li>
  <br />
  <li>
    <div align="justify"><strong>Token Tag Cloud (TTC)</strong>    :<br />
      Sometime back I read the blog article '<a href="http://fragmental.tw/2009/04/29/tag-clouds-see-how-noisy-your-code-is/">See How Noisy Your Code Is</a>'. TTC is tool for creating various tag clouds based on token types (e.g. keywords, names, classnames etc).    <br />
      </div>
  </li>
	<br />
  <li>
    <div align="justify"><strong>Treemap Visualization for Source Monitor Metrics data (SMTreemap)</strong>    :<br />
      <a href="http://www.campwoodsw.com/sourcemonitor.html">Source Monitor</a> is an excellent tool to generate various metrics from the source code (e.g. maxium complexity, averge compelxity, line count, block depth etc). However, it is difficult to quickly analyse this data for large code bases. Treemaps are excellent to visualize the hierarchicaldata on two dimensions (as size and color). This tool uses Tkinter to display the SourceMonitor data as treemap. You have to export the source monitor data as CSV or XML. smtreemap.py can then use this CSV or XML file as input to display the treemap    </div>
  </li>
</ol>

<h2 class="style1">Using the Tools</h2>
    
<ol>
	<li>
		<div><h3>Using Code Duplication Detector</h3>
		<pre>cdd.py [options] &lt;directory name&gt;</pre>Duplication results are displayed sorted in the descending order of number of duplicate lines found.
		<p>Options:
			<pre>-h, --help                     : show this help message and exit</pre>
			<pre>-p PATTERN, --pattern=PATTERN  : find duplications with files matching the pattern.
					If file pattern is not specified, CDD will check all the extensions supported by Pygments.</pre>
			<pre>-t, --treemap                  : display the duplication as treemap </pre>
			 
			<p>Treemap option shows the entire directory tree as 'treemap' and gives a 'big picture'
				view of proliferation of duplication.</p>
		</p>
		<ul>
		  <li><em>Green rectangles</em> : These files don't have any duplication      </li>
		  <li><em>White rectangles</em> : These files have low number of duplicated lines (around 10)      </li>
		  <li><em>Red rectangles</em> : These files have large number of duplicates      </li>
		  <li><em>Magenta lines inside the rectangles</em> : show the relative location of duplicate
			lines in the file.      <br />
		  </li>
		</ul>
	  </div>
	</li>
	<li>
		<div><h3>Using Token Tag Cloud</h3>
			<pre>ttc.py [options] &lt;directory name&gt;</pre>
			<div>
				Token Tag cloud parses the source code files and displays three tag clouds.
				<ol><li>Tag cloud of keyword</li>
				<li>Tag cloud of class names and variable names</li>
				<li>Tag cloud of class names and function names</li>
				</ol>
				The size of word is based on number of occurances of that 'token' in the various source code files
				The color of word is based on number of files that 'token' is found.
			</div>
			<p>Options:
				<pre>-h, --help            			: show this help message and exit</pre>
				<pre>-p PATTERN, --pattern=PATTERN	: create tag cloud of files matching the pattern.Default is '*.c</pre>
				<pre>-o OUTFILE, --outfile=OUTFILE	: outfile name. Output to stdout if not specified</pre>
			</p>
		</div>
	</li>
	<li><h3>Using SMTreemap</h3></li>
</ol>

</body>
</html>
